package com.tedu.day04mybatis.mapper;

import com.tedu.day04mybatis.pojo.User;
import com.tedu.day04mybatis.pojo.Weibo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface IWeibo {
    @Insert("INSERT INTO weibo(content,created,user_id)VALUES(#{content},#{created},#{userId})")
    public int insert(Weibo weibo);

    @Delete("DELETE FROM weibo WHERE id=#{id}")
    public int deleteById(Integer id);

    @Update("UPDATE weibo SET content=#{content},created=#{created} WHERE id=#{id}")
    public int updateById(Weibo weibo);

    @Select("SELECT id,content,created,user_id FROM weibo WHERE id=#{id}")
    public List<Weibo> selectById(Integer id);

    @Select("SELECT id,content,created,user_id FROM weibo")
    public List<Weibo> selectAll();
}
